package com.supercube.wechat.service.impl;

// import com.supercube.crm.vo.CourseVO;
// import com.supercube.crm.vo.GoodsVO;
import com.supercube.sport.yoga.domain.MemberCardBindingInfoDTO;
import com.supercube.sport.yoga.vo.MemberCardBasicInfoVO;
import com.supercube.wechat.dao.MiniAppApiDao;
import com.supercube.wechat.domain.*;
import com.supercube.wechat.response.AppointmentClassVO;
import com.supercube.wechat.response.ClassInfoVO;
import com.supercube.wechat.response.RecommendCourseVO;
import com.supercube.wechat.service.MiniAppApiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 小程序Api服务层实现
 *
 * @author djzhao
 * @date 19/11/03 10:28
 * @email djzhao627@gmail.com
 */
@Service
public class MiniAppApiServiceImpl implements MiniAppApiService {

    @Autowired
    private MiniAppApiDao miniAppApiDao;

    @Override
    public WeChatUserInfo getUserInfoWithOpenId(String openId) {
        return miniAppApiDao.getUserInfoWithOpenId(openId);
    }

    @Override
    public boolean insertMember(WeChatUserInfo userInfo) {
        return miniAppApiDao.insertMember(userInfo) > 0;
    }

    @Override
    public boolean insertWeChatUser(WeChatUserInfo userInfo) {
        return miniAppApiDao.insertWeChatUser(userInfo) > 0;
    }

    @Override
    public List<SlideImageDO> getHomeSlideImage() {
        return miniAppApiDao.getHomeSlideImage();
    }

    @Override
    public List<NotificationDO> getHomeNotification(int num) {
        return miniAppApiDao.getHomeNotification(num);
    }

    @Override
    public List<RecommendCourseVO> getRecommendCourse(int type) {
        return miniAppApiDao.getRecommendCourse(type);
    }

    @Override
    public List<ShopsDO> getShops() {
        return miniAppApiDao.getShops();
    }

    @Override
    public CustomPageDO getCustomPageById(int id) {
        return miniAppApiDao.getCustomPageById(id);
    }

    // @Override
    // public List<GoodsVO> getProductDetail(Integer id) {
    //     return miniAppApiDao.getProductDetail(id);
    // }

    @Override
    public List<AppointmentClassVO> getAppointmentCourseListByDate(String date) {
        return miniAppApiDao.getAppointmentCourseListByDate(date);
    }

    // @Override
    // public CourseVO getCourseDetailById(int courseId) {
    //     return miniAppApiDao.getCourseDetailById(courseId);
    // }

    @Override
    public boolean isAlreadyAppointment(int courseId, int memberId) {
        return miniAppApiDao.isAlreadyAppointment(courseId, memberId) > 0;
    }

    @Override
    public boolean submitAppointment(Integer curriculumId, Integer memberId) {
        return miniAppApiDao.submitAppointment(curriculumId, memberId);
    }

    @Override
    public List<ClassInfoVO> getAlreadyAppointmentCourseListByMemberId(String memberId, String date) {
        return miniAppApiDao.getAlreadyAppointmentCourseListByMemberId(memberId, date);
    }

    @Override
    public List<ClassInfoVO> getAppointmentCourseHistoryByMemberId(String memberId) {
        return miniAppApiDao.getAppointmentCourseHistoryByMemberId(memberId);
    }

    @Override
    public boolean cancelAppointment(String id) {
        return miniAppApiDao.cancelAppointment(id) > 0;
    }

    @Override
    public List<MemberCardBasicInfoVO> getVipCards(String memberId) {
        return miniAppApiDao.getVipCards(memberId);
    }

    @Override
    public List<ClassInfoVO> getClassList(String memberId, String date) {
        return miniAppApiDao.getClassList(memberId, date);
    }
}
